package com.lianmai.chaincard.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.lianmai.chaincard.R;

import butterknife.BindView;
import butterknife.OnClick;

import static com.lianmai.chaincard.Constants.SELECT_AREA_CODE;

/**
 * 创建日期：2018/8/15 0015
 * 作者:Kite
 * 找回密码
 */
public class RetrievePwdActivity extends BaseActivity {

    @BindView(R.id.tv_code_name)
    TextView codeNameTextView;

    @BindView(R.id.tv_send_code)
    TextView sendCodeTextView;

    @BindView(R.id.edt_phone)
    EditText phoneNumberEditText;

    @BindView(R.id.edt_code)
    EditText codeNumberEditText;

    @BindView(R.id.edt_password)
    EditText passwordNumberEditText;

    @Override
    public int getLayoutId() {
        return R.layout.activity_retrieve_pwd;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
    }

    @Override
    public void initView() {
        super.initView();
        setTitle(R.string.retrieve_pwd);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case SELECT_AREA_CODE:
                codeNameTextView.setText(String.format("+%s", data.getStringExtra("p0")));
                break;
        }
    }

    @OnClick({R.id.tv_code_name, R.id.tv_complete, R.id.tv_send_code})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_code_name://选地区
                advanceForResult(SelectAreaActivity.class, SELECT_AREA_CODE);
                break;
            case R.id.tv_send_code://获取验证码
                getCode(phoneNumberEditText, sendCodeTextView);
                break;
            case R.id.tv_complete://完成
                break;
        }
    }

}
